﻿package com.cc.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016091300503582";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC+glXxu1dOQkLONlLUiQRLwm+uHd8oc4JdafQ4ULuJlrIg8llT3HtPXekWP1E30OsTQaL+/pMDGo+SdGRVS18dva5V+8yWf7pnx771vWgcCPAM+Zz04h7ckiVjYX1WImfLSY824/U2M18G6wbNrX0HDiWkc/p4evNR+58R6KovR6jIY+SnB2OEGepXIYjgWeLDFWufw6puCLIt4j4f/Vjlf43PSDqgb3qGkbxPerkthSkM63ISlyx6MIzF5ctTIR1DTtCbyTlCo/6DLjIXbH1TzslOOxfVaIxSm7ocpAStslXUwB2yKpume01pOYi4esqG2W9PNtWuMUB8jMBHi0OfAgMBAAECggEAUGSf8AqmpRfBKVQzUA0iCvZaOpfQfDmCYfk8XidzfHRjZxPeLk10m+F9Yy4FEBDRoqaoKgMz9rNWsu77CCNuWBabYx2HEFuGRhU8uGbdcDc1VcRgP9bMPzhNHssdISQTuO2pyfgYmm7DQyAbFuCHSlrl96gZoo3/8DDGx7/vUVOpcoW/Bwq/7a4IFGDE/CqaFFPimRdUqAS36S972e2X1yZV/Utmi6dQwH0RZr/qJbvmcBTSpIXa4DfDW49ToKN+jvWcgV4gB/97inmTM4XVfIykAU+lfmGVGzLYwuw3tRoqlZLNA0dGFSE10Zqid3hQQ8zTp7KxEcV8AYLDl7QygQKBgQDpV8ozb9pylS9tgFbobczMPBz1L0G4hRovXdfMakROGZacLCS547e5hZaLGBMN8l+ztJATyggT1gGUNGztzzH49lH9/E6jaoM1QZ4/jBNHtozwar4POicZ1fj7XgOfWy55IZjG9QUB2w/CCYKaXhixMP3adHnoP1r5kO32yze7eQKBgQDRAdM3gLGBQgWcldboKKaBGVFDADnWqh9P9TiISGhh6Z82xNHcf0YdyypFsZRja/cQFAzY5vP2JpDV4X+JnTG4+cmxwMc3hL/RiClCB5lnWwjSUSBnol+N6ofA1ri8GY0fIKCv6oBgb+XHLrABqUwujOfhFjezHLnchBsl9F4Z1wKBgBotNwm+KotgIQnvs9AvQSJIPBdlTcIdbGqT5HmSEkeQp0ytxxDzctDlI5ZHBRwzbHkEcIVHzNAs2dB+cRncfIapW1lazJeYg0+eJNqMJD2PRRBTaS7cHzbOwjewvEdMO1JranAnXIBwyrvBxVz74Vk/Xbr8BhD/ynzkvU1KTt5BAoGAQ06UJ26ROy/4wKlcUN0uaaquiaYb+i5E8SnmL7UpsEZc2HVfo+N0wAl6LoF2aOIO6SWb0YnmjKF0yPvaZ4WwyoHeWxjazt04LJDtwG7UDv25BInNprIalYgueYJscV7FHH4UYTJibyv50kANvCs59k+4KLtP6qVYkVQVrg5Y83cCgYEAqowz3/oFQNmZL4+4yCLyZBXTip5Wi+wLM8J8HC2JfENVWIwdiskdsF0dwv6bklPIc50HhKvA2V6ZRmev/63+D3Bx0itlL5OsCv5N00PauV4e7M85MDdXVXiaf04jHquAKvbDUTfFqq8jI3BiUde2685NsXsoPJbNgWAWilq/KP0=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvoJV8btXTkJCzjZS1IkES8Jvrh3fKHOCXWn0OFC7iZayIPJZU9x7T13pFj9RN9DrE0Gi/v6TAxqPknRkVUtfHb2uVfvMln+6Z8e+9b1oHAjwDPmc9OIe3JIlY2F9ViJny0mPNuP1NjNfBusGza19Bw4lpHP6eHrzUfufEeiqL0eoyGPkpwdjhBnqVyGI4FniwxVrn8OqbgiyLeI+H/1Y5X+Nz0g6oG96hpG8T3q5LYUpDOtyEpcsejCMxeXLUyEdQ07Qm8k5QqP+gy4yF2x9U87JTjsX1WiMUpu6HKQErbJV1MAdsiqbpntNaTmIuHrKhtlvTzbVrjFAfIzAR4tDnwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://cuizhi.tunnel.qydev.com/alipay/web/notify_url";////

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://cuizhi.tunnel.qydev.com/alipay/web/return_url";////

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
//	public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

